// 引入webpack-merge
const { merge } = require('webpack-merge');
// 引入公共配置
const common = require('./webpack.common.js');
const path = require('path')
module.exports = merge(common, {
  mode: 'development',
  devtool: 'eval-cheap-module-source-map',
  performance: {
    hints: false,
    maxAssetSize: 1024 * 10,
  },
  devServer: {
    static: path.resolve(__dirname, 'dist'),
    compress: false,
    port: 9000,
    historyApiFallback: true, // 开启 否则history模式 刷新页面会404
    host: 'localhost',
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        changeOrigin: true,
        pathRewrite: { '^/api': '' },
      },
    },
    hot: true,
    open: true
  }
})